﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IWMAG.Scripting.Types {
    public class ArrayType : CodeType {
        public CodeType BaseType;

        public ArrayType(CodeType b) {
            BaseType = b;
        }

        public override string ToString() {
            return BaseType.ToString() + "[]";
        }

        public override bool Equals(object obj) {
            if (!(obj is ArrayType)) {
                return false;
            }

            ArrayType array = obj as ArrayType;
            return array.BaseType.Equals(CodeType.Void) || array.BaseType.Equals(BaseType);
        }

        public override int GetHashCode() {
            return BaseType.GetHashCode() + "[]".GetHashCode();
        }
    }
}
